﻿<controls:ChildWindow x:Class="SimpleMvvm.ItemDetailView"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
           Width="300" Height="160" 
           Title="Item">
    
    <!-- Label and TextBox styles -->
    <sdk:ChildWindow.Resources>
        <Style TargetType="sdk:Label">
            <Style.Setters>
                <Setter Property="Height" Value="28"/>
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="Margin" Value="10,0,0,0"/>
            </Style.Setters>
        </Style>
        <Style TargetType="TextBox">
            <Style.Setters>
                <Setter Property="HorizontalAlignment" Value="Left"/>
                <Setter Property="Margin" Value="5"/>
            </Style.Setters>
        </Style>
    </sdk:ChildWindow.Resources>

    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="136*" />
                <ColumnDefinition Width="242*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <sdk:Label Content="Item ID:" Grid.Row="0"/>
            <sdk:Label Content="Item Name:" Grid.Row="1" />

            <!-- Bind controls to Model properties -->
            <TextBox Name="itemId" Text="{Binding Path=Model.Id, Mode=TwoWay}" 
                     Grid.Column="1" Grid.Row="0" Height="28" Width="150"
                     IsReadOnly="True" Background="LightGray" />
            <TextBox Name="itemsName" Text="{Binding Path=Model.Name, Mode=TwoWay}" 
                     Grid.Column="1" Grid.Row="1" Height="28" Width="150"/>
        </Grid>

        <Button x:Name="CancelButton" Content="Cancel" Click="CancelButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,0,0" Grid.Row="1" />
        <Button x:Name="OKButton" Content="OK" Click="OKButton_Click" Width="75" Height="23" HorizontalAlignment="Right" Margin="0,12,79,0" Grid.Row="1" />
    </Grid>
</controls:ChildWindow>